﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AdoNetTest0002
{
    class Program
    {
        static void Main(string[] args)
        {
            var conString= "server=.;database=Admin3000;uid=sa;pwd=1";
            var sqlCon = new SqlConnection(conString);
            var cmdString = "selest*from Users";
            SqlCommand cmd = new SqlCommand(cmdString, sqlCon);
            sqlCon.Open();

            var reader = cmd.ExecuteReader();

            Console.WriteLine("{0}\t{1}", "名字", "年龄");
            while (reader.Read())
            {
                Console.WriteLine("{0}\t{1}", reader[0], reader[2] );
            }
            sqlCon.Close();
        }
    }
}
